package com.mystore.dao;

import com.mystore.entity.Cart;
import com.mystore.vo.GoodVO;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

public interface CartDao {

    /**
     * 通过用户id查找购物车
     * @param uid
     * @param connection
     * @return
     */
    List<GoodVO> findAllMyCartByUid(int uid,Connection connection);

    /**
     * 保存购物车
     * @param cart
     * @param connection
     * @return
     * @throws SQLException
     */
    Boolean save(Cart cart,Connection connection) throws SQLException;

    /**
     * 通过用户id和商品id查找实体
     * @param uid
     * @param gid
     * @param connection
     * @return
     */
    Cart findByUidAndGid(int uid,int gid,Connection connection);

    /**
     * 更新购物车
     * @param cart
     * @param connection
     * @return
     * @throws SQLException
     */
    Boolean updateCart(Cart cart,Connection connection) throws SQLException;

}
